import rxAjax from '@/assets/js/ajax.js';
import FormUtil from "@/assets/js/FormUtil";
import AtsAttenceCalculateApi from "@/api/oa/ats/atsAttenceCalculate";

//排班列表 api接口
export const AtsScheduleShiftApi = {};

AtsScheduleShiftApi.baseUrl= '/api-oa/oa/ats/atsScheduleShift';
AtsScheduleShiftApi.exportUrl= AtsScheduleShiftApi.baseUrl + '/listExport';

//查询列表
AtsScheduleShiftApi.query=function (parameter) {
  var url= AtsScheduleShiftApi.baseUrl + '/query';
  return rxAjax.postJson(url,parameter).then (res => {
    return res.result
  })
}

/**
* 获取单记录
* @param pkId
* @returns {*}
*/
AtsScheduleShiftApi.get =function(pkId) {
  var url= AtsScheduleShiftApi.baseUrl + '/get?pkId=' + pkId;
  return rxAjax.get(url);
}

//保存数据
AtsScheduleShiftApi.save =function(parameter) {
  var url= AtsScheduleShiftApi.baseUrl + '/save';
  return rxAjax.postJson(url,parameter);
}

//删除数据
AtsScheduleShiftApi.del =function(parameter) {
  var url= AtsScheduleShiftApi.baseUrl + '/del';
  return rxAjax.postUrl(url,parameter);
}

AtsScheduleShiftApi.getTest =function(parameter) {
  var url= AtsScheduleShiftApi.baseUrl + '/findAllS';
  return rxAjax.postJson(url,parameter);
}

AtsScheduleShiftApi.saveShiftData =function(shiftData) {
  var url= AtsScheduleShiftApi.baseUrl + '/saveShiftData';
  return rxAjax.postJson(url,shiftData);
}

//查找所查询的数据并导出
AtsScheduleShiftApi.listExport= function (parameter){
    var url= AtsScheduleShiftApi.baseUrl + '/listExport';
    FormUtil.doExport(url,parameter);
}


AtsScheduleShiftApi.doImport=function(formData,callback) {
    var url= AtsScheduleShiftApi.baseUrl+"/doImport";
    return rxAjax.upload(url,formData,callback);
}


export  default AtsScheduleShiftApi;

